West Midlands | ITP-Sept-25 | Mustaf Asani | Sprint 2 | coursework/sprint-2#777
West Midlands | ITP-Sept-25 | Mustaf Asani | Sprint 2 | coursework/sprint-2#777asaniDev wants to merge 14 commits intoCodeYourFuture:mainfrom
Conversation
| } No newline at end of file | ||
| // return the BMI of someone based off their weight and height | ||
| const bmi = weight / height ** 2; | ||
| return bmi.toFixed(1); |
There was a problem hiding this comment.
What type of value do you expect the function to return? A number or a string?
Does your function return the type of value you expect?
There was a problem hiding this comment.
the function will return a string representation of the equivalent number with the specified number of decimal places. I had expected it to produce a number but because i used the toFixed() method to shorten the answer to the required number of decimal places this changed.
There was a problem hiding this comment.
When a function does not perform as expected, shouldn't we change the function to meet our expectation (instead of the other around)?
|
|
||
| if (hours > 12) { | ||
| return `${hours - 12}:00 pm`; | ||
| return `${hours - 12}:${minutes} pm`; | ||
| } | ||
| return `${time} am`; | ||
| } |
There was a problem hiding this comment.
What do you expect from the following function calls?
formatAs12HourClock("00:00");
formatAs12HourClock("01:01");
formatAs12HourClock("13:01"); Does your function return the value you expected?
There was a problem hiding this comment.
the 00:00 input did not give the expected value. I added a condition to handle the hours between midnight and 01 am so all 00 hours.
There was a problem hiding this comment.
What about making the format of the returned string values from these two function calls more consistent?
formatAs12HourClock("01:01");
formatAs12HourClock("13:01");
There was a problem hiding this comment.
thank you i had missed that, made the format for both times match, romved the trailing zero.
|
Changes look good! |
Learners, PR Template
Self checklist
Changelist
finished all the tasks for coursework sprint 2